const { Controller } = require('egg');

class ViewController extends Controller {
  async index() {
    const { ctx, app } = this;
    console.log(ctx.params);
    const { page } = ctx.params || {};
    const options = app.config?.options || {};

    await ctx.render(`${page}/entry.${page}.tpl`, {
      name: app.name,
      env: app.config.env,
      options: JSON.stringify(options),
    });
  }
}

module.exports = ViewController;
